package com.example.demo.web;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;

@RestController
public class Controller {

    @Resource
    private RabbitTemplate rabbitTemplate;


    @RequestMapping("/sendMsg")
    public String saveHello() {
        CorrelationData cd = new CorrelationData();
        //发布确认，保证消息可靠性
        rabbitTemplate.convertAndSend("topic.exchange","news.wy163.com","123123",cd);

        return "hello world";
    }
}
